package com.tgm.controller;

import com.tgm.domain.common.Result;
import com.tgm.domain.entity.MerchantInfo;
import com.tgm.service.MerchantInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商户信息表(MerchantInfo)表控制层
 *
 * @author makejava
 * @since 2025-10-20 20:59:29
 */
@RestController
@RequestMapping("/merchantInfo")
public class MerchantInfoController{
    @Autowired
    private MerchantInfoService merchantInfoService;
    @GetMapping("/list/merchantType")
    public Result listMerchantType(){
        List<String> merchantType = merchantInfoService.query().select("merchant_type")
                .groupBy("merchant_type")
                .list()
                .stream().map(MerchantInfo::getMerchantType).toList();
        return Result.success(merchantType);
    }
}

